/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.schedule.manage.service;

import info.peigen.hotpot.common.core.result.PageResult;
import info.peigen.hotpot.component.schedule.core.repository.service.ScheduleJobRepository;
import info.peigen.hotpot.component.schedule.core.service.ScheduleJobService;
import info.peigen.hotpot.component.schedule.facade.command.order.ScheduleJobChangeAllOrder;
import info.peigen.hotpot.component.schedule.facade.command.order.ScheduleJobCreateOrder;
import info.peigen.hotpot.component.schedule.facade.command.order.ScheduleJobDeleteOrder;
import info.peigen.hotpot.component.schedule.facade.command.order.ScheduleJobEditOrder;
import info.peigen.hotpot.component.schedule.facade.command.result.ScheduleJobChangeAllResult;
import info.peigen.hotpot.component.schedule.facade.command.result.ScheduleJobCreateResult;
import info.peigen.hotpot.component.schedule.facade.command.result.ScheduleJobDeleteResult;
import info.peigen.hotpot.component.schedule.facade.command.result.ScheduleJobEditResult;
import info.peigen.hotpot.component.schedule.facade.command.result.info.ScheduleJobManageInfo;
import info.peigen.hotpot.component.schedule.manage.form.*;
import info.peigen.hotpot.component.schedule.manage.util.ScheduleJobManageConvertor;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;

/**
 * <b>(ScheduleJobManageService)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023/1/6
 */
@SuppressWarnings("AlibabaServiceOrDaoClassShouldEndWithImpl")
@Component
public class ScheduleJobManageService {
    @Inject
    private ScheduleJobRepository scheduleJobRepository;
    @Inject
    private ScheduleJobService    scheduleJobService;

    public PageResult<ScheduleJobManageInfo> page(ScheduleJobManageSearchForm form) {
        // PageResult<ScheduleJobManageInfo> page = scheduleJobRepository.page(form, entity -> ScheduleJobConvertor.convertToInfo(entity));
        // return page;
        return null;
    }

    public ScheduleJobCreateResult add(ScheduleJobManageAddForm form) {
        ScheduleJobCreateOrder order = ScheduleJobManageConvertor.convertOrder(form);
        return scheduleJobService.create(order);
    }

    public ScheduleJobEditResult edit(ScheduleJobManageEditForm form) {
        ScheduleJobEditOrder order = ScheduleJobManageConvertor.convertOrder(form);
        return scheduleJobService.edit(order);
    }

    public ScheduleJobDeleteResult delete(ScheduleJobManageDeleteForm form) {
        ScheduleJobDeleteOrder order = ScheduleJobManageConvertor.convertOrder(form);
        return scheduleJobService.delete(order);
    }

    public ScheduleJobChangeAllResult changeAll(ScheduleJobManageChangeAllForm form) {
        ScheduleJobChangeAllOrder order = ScheduleJobManageConvertor.convertOrder(form);
        return scheduleJobService.changeAll(order);
    }
}